package fanzhuan;

public class Fanzhuan {
    public static void main(String[] args) {
        String text = "You think you can";
        System.out.println(text);
        String another = reverseWords(text);
        System.out.println(another);
    }

    private static String reverseWords(String text) {
        StringBuffer another = new StringBuffer();
        String[] a = text.split(" ");
        for (int i=0;i<a.length;i++){
            another.append(reverseWord(a[i]));
            if (i!=a.length-1){
                another.append(" ");
            }
        }
        return another.toString();
    }
    private static String reverseWord(String word){
        StringBuffer another = new StringBuffer();
        for (int i=word.length()-1;i >=0;i--){
            another.append(word.charAt(i));
        }
        return another.toString();
    }
}


